//
//  ReadingViewController.m
//  Miss
//
//  Created by Alan on 15/1/28.
//  Copyright (c) 2015年 Alan. All rights reserved.
//

#import "ReadingViewController.h"
#import "XQReadingViewController.h"
#import "FenLeiViewController.h"
#import "ReadingCell.h"
@interface ReadingViewController ()<UITableViewDataSource,UITableViewDelegate>

@end

@implementation ReadingViewController
- (void)dealloc
{
    [_table release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
        // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor cyanColor];
  
    
    self.title = @"Reading";
    //设置透明度
    self.navigationController.navigationBar.translucent = YES;
    //设置Bar的颜色
    // self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
    
    //左上角 音乐按钮
    self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"yinlehome.png"] style:UIBarButtonItemStyleDone target:self action:@selector(listionAction:)]autorelease];
    //右上角 分类按钮
    self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"fenlei.png"] style:UIBarButtonItemStyleDone target:self action:@selector(FenLeiAction:)]autorelease];
    
    //精选tabelVIew
    self.table = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.table.delegate = self;
    self.table.dataSource = self;
    self.table.separatorStyle = UITableViewCellAccessoryCheckmark;
    [self.view addSubview:_table];
    [_table release];
    
   
    
}
//点击进入文章详情
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.table deselectRowAtIndexPath:indexPath animated:YES];
    XQReadingViewController *XQread = [[XQReadingViewController alloc]init];
    [self.navigationController pushViewController:XQread animated:YES];
    [XQread release];
}
//调到音乐界面
- (void)listionAction:(UIBarButtonItem *)listionButton
{
    NSLog(@"音乐");
}
//调到分类界面
- (void)FenLeiAction:(UIBarButtonItem *)fenleiButton
{
   
        FenLeiViewController *FenLei = [[FenLeiViewController alloc]init];
    
        [self.navigationController pushViewController:FenLei animated:NO];
    
        [FenLei release];
}

//行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}
//精选cell 的设置
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *str = @"jun";
    ReadingCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
    if (cell == nil) {
        cell = [[[ReadingCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:str]autorelease];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;

}
//
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 180;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
